<template>
    <div id="wai">
        <div class="zuo">
            <table>
                <tr>
                    <td rowspan="3">
                        <div class="geren">
                            <p>{{ $store.state.user.username }}<br /><br /><br />{{ $store.getters['user/isSeller'] }}</p>
                        </div>
                    </td>
                </tr>
                <tr></tr>
                <tr></tr>
                <tr>
                    <td><router-link to="/user/my_orders">我的订单</router-link></td>
                </tr>
                <tr>
                    <td><router-link to="/user/shipping_address">收货地址</router-link></td>
                </tr>
                <tr>
                    <td v-if="flag"><router-link to="/user/become_a_merchant">成为商家</router-link></td>
                    <td v-if="!flag"><router-link to="/user/merchandise_control/grounding_goods">商品管理</router-link></td>
                </tr>
                <tr>
                    <td><a @click="login_out" href="#">退出登录</a></td>
                    <!-- <td><router-link @click="login_out" to="#">退出登录</router-link></td> -->
                </tr>
                <tr>
                    <td></td>
                </tr>
            </table>
        </div>
        <div class="you">
            <router-view></router-view>
        </div>
    </div>
</template>
                  
<script>


export default {
    name: 'personal_center_page',
    data() {
        return {
            flag: true,
        }
    },
    methods: {
        is_seller() {
            if (this.$store.state.user.is_seller === 1) {
                this.flag = !this.flag;
            }
        },
        login_out() {
            this.$http.post("login_out.php",
                { 'session_id': this.$auth.getAuthorization() },
                {
                    header: {
                        'Content-Type': 'application/json'
                    }
                }).then(res => {
                    console.log(res.data);
                    console.log("请求已发送,成功");
                }).catch(() => {
                    console.log('失败');
                });
            this.$store.commit('user/login_out');
            alert('退出成功');
            console.log('login_out');
        }
    },
    created() {
        this.is_seller();
    }

}

</script>
  
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
* {
    /* 初始化 */
    margin: 0;
    padding: 0;
}

#wai {
    width: 100%;
    height: 895px;
    border: 1px solid rgb(33, 199, 132);
    padding: 0;

    .zuo {
        width: 29%;
        height: 895px;
        float: left;
        border: 1px solid blue;


        table {
            width: 100%;
            height: 100%;
            border: 1px solid red;

            td {
                width: 100%;
                height: 13%;
                border: 1px solid red;
                font-size: 40px;
                text-align: center;

                .geren {
                    overflow: hidden;
                    /* border: 1px solid red; */
                    /* width: 360px;
                    height: 310px; */
                    margin: auto;
                    padding: auto;

                    p {
                        font-size: 60px;
                        margin-top: 15%;
                        margin-bottom: 3%;
                        line-height: 50%;
                    }

                }


                a {
                    color: pink;
                    text-decoration: none;
                }

                a:hover {
                    /* 鼠标移到链接上 */
                    color: #0bc2d6;
                    text-decoration: underline;
                }

                a:active {
                    /* 正在点击的链接 */
                    color: #03031f;
                    text-decoration: underline;
                }
            }
        }
    }

    .you {
        width: 70%;
        height: 895px;
        float: right;
        border: 1px solid blue;
    }

}
</style>
                                                                          